home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / boxesfronttoback.pprx < prev    next >
Text File  |  1993-01-29  |  4KB  |  121 lines

  1. /* Boxes Front to Back
  2. Select boxes by name or number and rearrange them from front to back in order. Useful in complex layouts where there are several boxes on top of each other.
  3. You will be given a list of boxes, and asked to double-click on the names in order from front to back. You can click on Cancel at any time to finish the process. 
  4. Written by Don Cox © Aug 92   */
  5.  
  6. signal on error
  7. signal on syntax
  8. call ppm_AutoUpdate(0)
  9. cr = "0a"x
  10.  
  11. address command
  12. call SafeEndEdit.rexx()
  13.  
  14. call ppm_ShowStatus("Making List of Boxes ...")
  15. thispage = ppm_CurrentPage()
  16. totalboxes = ppm_NumBoxes(thispage)
  17. list = ""
  18. numberlist = ""
  19. box = ppm_PageFirstBox(thispage)
  20. do i = 1 to totalboxes
  21.     number = right(ppm_BoxNum(box),3," ")
  22.     numberlist = numberlist" "number 
  23.     info = ppm_GetBoxInfo(box)
  24.     boxtype = word(info,1)
  25.     boxname = ppm_GetBoxName(box)
  26.     select
  27.         when upper(boxtype) = "TEXT" then do
  28.             boxtext = ppm_GetBoxText(box,0)
  29.             shorttext = substr(boxtext,1,15)
  30.             if boxname = "" then boxname = shorttext
  31.             end
  32.         when upper(boxtype) = "BITMAP" then do
  33.             filename = word(info,5)
  34.             filename = substr(filename, lastpos("/",filename)+1)
  35.             if boxname = "" then boxname = filename
  36.             end
  37.         when upper(boxtype) = "EPSF" then do
  38.             filename = word(info,3)
  39.             filename = substr(filename, lastpos("/",filename)+1)
  40.             if boxname = "" then boxname = filename
  41.             end
  42.         when upper(boxtype) = "CLIP" then do
  43.             objects = "Clip, "||word(info,2)||" objects"
  44.             if boxname = "" then boxname = objects
  45.             end
  46.         when upper(boxtype) = "STRUCTURED" then do
  47.             objects = "Struct., "||word(info,2)||" objects"
  48.             if word(info,2)=1 then objects = "Struct., 1 object"
  49.             if boxname = "" then boxname = objects
  50.             end
  51.         when upper(boxtype) = "EMPTY" then do
  52.             if boxname = "" then boxname = "Empty"
  53.             end
  54.         otherwise boxname = "Unknown type of box"
  55.     end
  56.     boxtype = substr(boxtype,1,1)
  57.     list = list||number" "boxname||cr
  58.     box = ppm_PageNextBox(box)
  59.     end
  60.  
  61. call ppm_ClearStatus()
  62. form = ""
  63. series = ""
  64.     box = ppm_SelectFromList("Double-click front box",34,18,0,list)
  65.     series = series||" "||word(box,1)
  66.     form = box||":1"||"0a"x
  67.  
  68. do i = 2 to totalboxes
  69.     box = ppm_SelectFromList("Double-click next box",34,18,0,list)
  70.     if box = "" then break
  71.     series = series||" "||word(box,1)
  72.     form = form||box":"||i||"0a"x
  73.     end
  74.  
  75. accept = ppm_GetForm("Is this OK?",3,form)
  76. if accept = "" then exit_msg("Aborted by user ")
  77.  
  78. newnumbers = numberlist
  79. numselected = words(series)
  80. do i=1 to numselected
  81.     this = word(series,i)
  82.     do w = 1 to words(numberlist)
  83.         that = word(numberlist,w)
  84.         chars = length(that)
  85.         pad = left("XXXXXX",chars)
  86.         pad = " "pad" "
  87.         position = wordindex(newnumbers,w)
  88.         if this = that then do
  89.             newnumbers = insert(pad,newnumbers,position)
  90.             newnumbers = delword(newnumbers,w,1)
  91.             leave w
  92.             end
  93.         end
  94.     end
  95. newnumbers = compress(newnumbers,"X")
  96.  
  97. series = series||" "||newnumbers /* stick the unselected boxes on the end of the list */
  98.  
  99. do until series = ""
  100.     parse var series box series
  101.     call ppm_BoxToBack(box)
  102.     end
  103.  
  104. exit_msg()
  105.  
  106. error:
  107. syntax:
  108.     do
  109.     exit_msg("Genie failed due to error: "errortext(rc))
  110.     end
  111.  
  112. exit_msg:
  113.     do
  114.     parse arg message
  115.     if message ~= "" then
  116.     call ppm_Inform(1,message,"Resume")
  117.     call ppm_ClearStatus()
  118.     call ppm_AutoUpdate(1)
  119.     exit
  120.     end
  121.